<?php
    require_once('../includes/DbConnector.php');
    
    if(isset($_GET['action']) && !empty($_GET['action'])) {
        // INPUT DATA.
        $action = $_GET['action'];
        $barid = $_GET['barid'];
        
        $connector  = new DbConnector();
        $sql = "select
                c.*,
                u.first_name,
                u.last_name
                from comment c, user_account u
                where bar_id = '$barid'
                and c.user_id = u.user_id
                order by c.date desc, c.time desc";
        $result = $connector->query($sql);
        
        $a=array();
        while($row = mysql_fetch_array($result)){
            array_push($a,$row);
        }
        echo json_encode($a);
    }
?>